<?php
    require_once '../../includes/includes.php';
    
    
    $db->select('shmekeri', '*');
    $counter = $db->fetch();
    $counter = $counter['count'];
     
?>

<html>
    <head>
        <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.0.min.js"></script>
    </head>
    <body>
        <a href="../">Back</a>
        <br />
        <input type="text" id="counter" value="<?php echo $counter; ?>" />
        <script type="text/javascript">
            
        /*  CHANGE CONTENT START  */

        $('#counter').focusin(function () {
            $(this).css({'background':'yellow'});
        }).blur(function () {
            $(this).css({'background':'#C5FEF0'});
            changeContent($(this));
        });

        function changeContent(element) {

            var counter = element.val();

            $.ajax({
                url:'changeCounter.php',
                type:"POST",
                data:{ counter : counter },
                success:function (res) {
                    console.log(res);
                }
            });
        }

        /*  CHANGE CONTENT END  */
        </script>
    </body>
</html>

